

package org.wing.mouseListener;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JLabel;
import org.come.Frame.TestpackJframe;
import org.come.Frame.ZhuFrame;
import org.come.Jpanel.TestpackJapnel;
import org.come.Jpanel.ZhuJpanel;
import org.come.entity.Goodstable;
import org.come.until.GoodsListFromServerUntil;
import org.come.until.MessagrFlagUntil;
import org.wing.panel.WingMainPanel;

public class UpgradeGoodsMouseListener extends MouseAdapter
{

	private int type;
	private WingMainPanel wingMainPanel;

	public UpgradeGoodsMouseListener(int type, WingMainPanel wingMainPanel)
	{
		this.type = type;
		this.wingMainPanel = wingMainPanel;
	}

	@Override
    public void mousePressed(MouseEvent e)
	{
		if (e.getButton() == 3)
		{
			wingMainPanel.setChosegoods(GoodsListFromServerUntil.getUpgradeGoods(type, wingMainPanel));
			if (wingMainPanel.getChosegoods() == null) {
                return;
            }
			wingMainPanel.getChooseGoodsImg().setIcon(GoodsListFromServerUntil.imgpathAdaptive(wingMainPanel.getChosegoods().getSkin(), 58, 56));
		}
	}

	@Override
    public void mouseEntered(MouseEvent e)
	{
		if (MessagrFlagUntil.ImgFlagImg.equals(MessagrFlagUntil.MOUSE1)) {
			MessagrFlagUntil.setMouse(MessagrFlagUntil.MOUSE12);
		}
		Goodstable goodstable = GoodsListFromServerUntil.getUpgradeGoods(type, wingMainPanel);
		if (goodstable != null) {
            ZhuFrame.getZhuJpanel().creatgoodtext(goodstable);
        }
	}

	@Override
    public void mouseExited(MouseEvent e)
	{
		if (MessagrFlagUntil.ImgFlagImg.equals(MessagrFlagUntil.MOUSE12)) {
			MessagrFlagUntil.setMouse(MessagrFlagUntil.MOUSE1);
		}
		TestpackJframe.getTestpackJframe().getJpac().ClearText();
		ZhuFrame.getZhuJpanel().cleargoodtext();
	}

	public int getType()
	{
		return type;
	}

	public void setType(int type)
	{
		this.type = type;
	}
}
